package cn.zxh.improvement.gencode.processor;

import cn.zxh.improvement.gencode.spi.CodeGenProcessor;
import com.squareup.javapoet.*;

import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.element.TypeElement;

/**
 * 基础的生成器
 *
 * @author zxh
 * @since 2023/5/6 16:50:58
 */
public abstract class BaseCodeGenProcessor implements CodeGenProcessor {

    public static final String PREFIX = "Base";

    @Override
    public void generate(TypeElement typeElement, RoundEnvironment roundEnvironment)
            throws Exception {
        //添加其他逻辑扩展
        generateClass(typeElement, roundEnvironment);
    }

    /**
     * 生成class 类
     *
     * @param typeElement
     * @param roundEnvironment
     * @return
     */
    protected abstract void generateClass(TypeElement typeElement,
                                          RoundEnvironment roundEnvironment);

}

